package xiaomogu.task_engine.admin.core.scheduler;


public enum MisfireStrategy {

    /**
     * do nothing
     */
    DO_NOTHING("do_nothing"),

    /**
     * fire once now
     */
    FIRE_ONCE_NOW("fire_once_now");

    private String code;

    MisfireStrategy(String code) {
        this.code = code;
    }

    public static MisfireStrategy match(String code, MisfireStrategy defaultItem) {
        for (MisfireStrategy misfireStrategy : MisfireStrategy.values()) {
            if (misfireStrategy.name().equals(code)) {
                return misfireStrategy;
            }
        }
        return defaultItem;
    }

    public String getCode() {
        return code;
    }

}
